import 'package:logger/logger.dart';

class SimpleLogPrinter extends LogPrinter {
  final String className;

  SimpleLogPrinter(this.className);

  @override
  List<String> log(LogEvent event) {
    final level = event.level.toString().toUpperCase().split('.').last;
    final time = DateTime.now().toIso8601String();
    final message = event.message;
    final error = event.error;
    final lines = <String>[];

    lines.add("[$level][$className][$time] $message");
    if (error != null) {
      lines.add("[$level][$className][ERROR] $error");
    }

    return lines;
  }
}
